package com.woniuxy.admin.controller;


import com.woniuxy.admin.service.ResourceService;
import com.woniuxy.core.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ...
 * @since 2024年05月22日
 */
@RestController
@RequestMapping("/resource")
@Api(tags="资源管理")
public class ResourceController {

    @Resource
    private ResourceService resourceService;

    /**
     * 根据角色查询资源
     * @param roleId
     * @return
     */
    @GetMapping("/findResourceByRoleId")
    @ApiOperation("根据角色查询资源")
    @ApiImplicitParam(name = "roleId",value = "角色Id")
    public Result findResourceByRoleId(Integer roleId){
        List<String> resources = resourceService.findResourceByRoleId(roleId);
        return Result.success("查询资源成功",resources);
    }

}

